﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.CodeDom;
using GameStudio.Framework.GraphicsEngine;
using System.CodeDom.Compiler;
using SlimDX.Direct3D9;

namespace GameStudio.CodeGeneration
{
    public class GenerateEmptyClass:Sample
    {
        public GenerateEmptyClass(string strFileName, string Path, string NameSpace)
            : base(strFileName, Path, NameSpace)
        {

            base.AssignObjects();
            samples.Imports.Add(new CodeNamespaceImport("System.IO"));

            base.Init();
            
        }

        private void AddReferences()
        {
            compilerParams.ReferencedAssemblies.Add("GameStudio.Framework.GraphicsEngine.dll");
            //targetUnit.ReferencedAssemblies.Add("GameStudio.Framework.GraphicsEngine.dll");
        }


        public void Generate(string ParentClass)
        {
            if (ParentClass != null)
            {
                base.AddParentClass(ParentClass);
            }

            samples.Imports.Add(new CodeNamespaceImport("GameStudio.Framework.GraphicsEngine"));
            AddReferences();

            CompilerResults result = base.GenerateCSharpCode();
            if (result.Errors.HasErrors)
            {
                Sample.DisplayCompilerResults(result);
            }
            //else
            //{
            //    System.Reflection.Assembly a = result.CompiledAssembly;
            //}

        }
    }
}
